import request from '@/utils/request'

/**
 * 获取账号列表
 * @param {*} params
 * @returns
 */
export function getAccountList (params) {
  return request({
    url: '/api.php/admin/role_list',
    method: 'get',
    params
  })
}

/**
 * 添加账号
 * @param {*} data
 * @returns
 */
export function addAccount (data) {
  return request({
    url: '/api.php/user/register',
    method: 'post',
    data
  })
}

/**
 * 删除账号
 * @param {*} data
 * @returns
 */
export function removeAccount (data) {
  return request({
    url: '/api.php/admin/del',
    method: 'post',
    data
  })
}

/**
 * 获取账号详情
 * @param {*} data
 * @returns
 */
export function getAccountDetail (data) {
  return request({
    url: '/api.php/admin/edit',
    method: 'post',
    data
  })
}

export function editAccount (data) {
  return request({
    url: '/api.php/admin/edit',
    method: 'post',
    data
  })
}

/**
 * 导出账号
 * @param {*} params
 * @returns
 */
export function exportAccount (params) {
  return request({
    url: '/api.php/admin/export',
    method: 'get',
    responseType: 'blob',
    params
  })
}
